<template>
  <PcIndex v-if="!isMobile"></PcIndex>
</template>

<script setup>
import {reactive, ref, onMounted, onUnmounted, defineAsyncComponent, nextTick, defineProps} from "vue";
import { useRouter } from 'vue-router';

const router = useRouter();
const PcIndex = defineAsyncComponent(() => import('/@/views/home/pcindex.vue'));
const isMobile = ref(false)
const checkDeviceType = ()=>{
  const viewportWidth = window.innerWidth;
  isMobile.value = viewportWidth < 768;
}

onMounted(()=>{
  nextTick(()=>{
    checkDeviceType();
    if(isMobile.value){
      router.push('/phone');
    }
  })
})
</script>
<style scoped lang="scss">
</style>
